using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class vItemMap : EntityTypeConfiguration<vItem>
    {
        public vItemMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Item, t.Type, t.Category, t.TypeId, t.CategId, t.Description, t.Cost });

            // Properties
            this.Property(t => t.Item)
                .IsRequired()
                .HasMaxLength(10);

            this.Property(t => t.Type)
                .IsRequired()
                .HasMaxLength(25);

            this.Property(t => t.Category)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.TypeId)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.CategId)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.Vendor)
                .HasMaxLength(35);

            this.Property(t => t.Customv2)
                .HasMaxLength(30);

            this.Property(t => t.Customv3)
                .HasMaxLength(30);

            this.Property(t => t.SeasonName)
                .HasMaxLength(50);

            this.Property(t => t.Customv4)
                .HasMaxLength(30);

            this.Property(t => t.Customv5)
                .HasMaxLength(30);

            this.Property(t => t.Usage)
                .HasMaxLength(30);

            this.Property(t => t.ModeOfShip)
                .HasMaxLength(30);

            this.Property(t => t.ABCClassif)
                .HasMaxLength(2);

            this.Property(t => t.XYZClassif)
                .HasMaxLength(2);

            this.Property(t => t.vendSrh)
                .HasMaxLength(6);

            this.Property(t => t.Item_srh)
                .HasMaxLength(10);

            this.Property(t => t.Description)
                .IsRequired()
                .HasMaxLength(250);

            this.Property(t => t.BARCODE1)
                .HasMaxLength(30);

            this.Property(t => t.BARCODE2)
                .HasMaxLength(30);

            this.Property(t => t.BARCODE3)
                .HasMaxLength(30);

            this.Property(t => t.BARCODE4)
                .HasMaxLength(30);

            this.Property(t => t.Unit_of_Sales)
                .HasMaxLength(8);

            this.Property(t => t.Unit_of_Orders)
                .HasMaxLength(8);

            this.Property(t => t.Barcode)
                .HasMaxLength(30);

            this.Property(t => t.Item_Currency)
                .HasMaxLength(5);

            this.Property(t => t.symbol)
                .HasMaxLength(5);

            // Table & Column Mappings
            this.ToTable("vItems");
            this.Property(t => t.Item).HasColumnName("Item");
            this.Property(t => t.Type).HasColumnName("Type");
            this.Property(t => t.Category).HasColumnName("Category");
            this.Property(t => t.TypeId).HasColumnName("TypeId");
            this.Property(t => t.CategId).HasColumnName("CategId");
            this.Property(t => t.Vendor).HasColumnName("Vendor");
            this.Property(t => t.Customv1).HasColumnName("Customv1");
            this.Property(t => t.Customv2).HasColumnName("Customv2");
            this.Property(t => t.Customv3).HasColumnName("Customv3");
            this.Property(t => t.SeasonName).HasColumnName("SeasonName");
            this.Property(t => t.Customv4).HasColumnName("Customv4");
            this.Property(t => t.Customv5).HasColumnName("Customv5");
            this.Property(t => t.Country).HasColumnName("Country");
            this.Property(t => t.BU).HasColumnName("BU");
            this.Property(t => t.Cluster).HasColumnName("Cluster");
            this.Property(t => t.ProductLine).HasColumnName("ProductLine");
            this.Property(t => t.ItemKind).HasColumnName("ItemKind");
            this.Property(t => t.Program).HasColumnName("Program");
            this.Property(t => t.Group_Number).HasColumnName("Group Number");
            this.Property(t => t.GrpNumId).HasColumnName("GrpNumId");
            this.Property(t => t.Subgroup).HasColumnName("Subgroup");
            this.Property(t => t.Family).HasColumnName("Family");
            this.Property(t => t.Usage).HasColumnName("Usage");
            this.Property(t => t.Class).HasColumnName("Class");
            this.Property(t => t.ModeOfShip).HasColumnName("ModeOfShip");
            this.Property(t => t.ABCClassif).HasColumnName("ABCClassif");
            this.Property(t => t.XYZClassif).HasColumnName("XYZClassif");
            this.Property(t => t.vendSrh).HasColumnName("vendSrh");
            this.Property(t => t.ExpiryDateEnabled).HasColumnName("ExpiryDateEnabled");
            this.Property(t => t.Item_srh).HasColumnName("Item_srh");
            this.Property(t => t.Description).HasColumnName("Description");
            this.Property(t => t.Factor).HasColumnName("Factor");
            this.Property(t => t.Physical).HasColumnName("Physical");
            this.Property(t => t.On_Order).HasColumnName("On Order");
            this.Property(t => t.On_Hand).HasColumnName("On Hand");
            this.Property(t => t.Unit_Cost).HasColumnName("Unit Cost");
            this.Property(t => t.Cost).HasColumnName("Cost");
            this.Property(t => t.Comments).HasColumnName("Comments");
            this.Property(t => t.MTD_Rcpts).HasColumnName("MTD Rcpts");
            this.Property(t => t.MTD_Issue).HasColumnName("MTD Issue");
            this.Property(t => t.MTD_Ad).HasColumnName("MTD Ad");
            this.Property(t => t.YTD_Adj).HasColumnName("YTD Adj");
            this.Property(t => t.YTD_Rcpts).HasColumnName("YTD Rcpts");
            this.Property(t => t.YTD_Issue).HasColumnName("YTD Issue");
            this.Property(t => t.Min_Qty).HasColumnName("Min Qty");
            this.Property(t => t.Max_Qty).HasColumnName("Max Qty");
            this.Property(t => t.BARCODE1).HasColumnName("BARCODE1");
            this.Property(t => t.BARCODE2).HasColumnName("BARCODE2");
            this.Property(t => t.BARCODE3).HasColumnName("BARCODE3");
            this.Property(t => t.BARCODE4).HasColumnName("BARCODE4");
            this.Property(t => t.Physical_Date).HasColumnName("Physical Date");
            this.Property(t => t.In_Date).HasColumnName("In Date");
            this.Property(t => t.Out_Date).HasColumnName("Out Date");
            this.Property(t => t.Adj_Date).HasColumnName("Adj Date");
            this.Property(t => t.In_Qty).HasColumnName("In Qty");
            this.Property(t => t.Out_Qty).HasColumnName("Out Qty");
            this.Property(t => t.Adj_Qty).HasColumnName("Adj Qty");
            this.Property(t => t.Unit_of_Sales).HasColumnName("Unit of Sales");
            this.Property(t => t.Unit_of_Orders).HasColumnName("Unit of Orders");
            this.Property(t => t.cost1).HasColumnName("cost1");
            this.Property(t => t.cost2).HasColumnName("cost2");
            this.Property(t => t.Total1).HasColumnName("Total1");
            this.Property(t => t.Total2).HasColumnName("Total2");
            this.Property(t => t.cost1_).HasColumnName("cost1$");
            this.Property(t => t.cost2_).HasColumnName("cost2$");
            this.Property(t => t.Total1_).HasColumnName("Total1$");
            this.Property(t => t.Total2_).HasColumnName("Total2$");
            this.Property(t => t.FOBCOST).HasColumnName("FOBCOST");
            this.Property(t => t.SHIPCOST).HasColumnName("SHIPCOST");
            this.Property(t => t.OPERCOST).HasColumnName("OPERCOST");
            this.Property(t => t.Shipment_).HasColumnName("Shipment%");
            this.Property(t => t.Operation_).HasColumnName("Operation%");
            this.Property(t => t.Min__Order_Qty_).HasColumnName("Min. Order Qty.");
            this.Property(t => t.RetailMargin).HasColumnName("RetailMargin");
            this.Property(t => t.WholesaleMargin).HasColumnName("WholesaleMargin");
            this.Property(t => t.RetailListPrice).HasColumnName("RetailListPrice");
            this.Property(t => t.WholesaleListPrice).HasColumnName("WholesaleListPrice");
            this.Property(t => t.Max_Retail_Discount).HasColumnName("Max.Retail Discount");
            this.Property(t => t.Max__Wholesale_Discount).HasColumnName("Max. Wholesale Discount");
            this.Property(t => t.RetailPrice).HasColumnName("RetailPrice");
            this.Property(t => t.WholesalePrice).HasColumnName("WholesalePrice");
            this.Property(t => t.Unit1).HasColumnName("Unit1");
            this.Property(t => t.Unit2).HasColumnName("Unit2");
            this.Property(t => t.Unit3).HasColumnName("Unit3");
            this.Property(t => t.Unit4).HasColumnName("Unit4");
            this.Property(t => t.Factor1).HasColumnName("Factor1");
            this.Property(t => t.Factor2).HasColumnName("Factor2");
            this.Property(t => t.Factor3).HasColumnName("Factor3");
            this.Property(t => t.Factor4).HasColumnName("Factor4");
            this.Property(t => t.PenaltyType1).HasColumnName("PenaltyType1");
            this.Property(t => t.PenaltyType2).HasColumnName("PenaltyType2");
            this.Property(t => t.PenaltyType3).HasColumnName("PenaltyType3");
            this.Property(t => t.PenaltyType4).HasColumnName("PenaltyType4");
            this.Property(t => t.Penalty1).HasColumnName("Penalty1");
            this.Property(t => t.Penalty2).HasColumnName("Penalty2");
            this.Property(t => t.Penalty3).HasColumnName("Penalty3");
            this.Property(t => t.Penalty4).HasColumnName("Penalty4");
            this.Property(t => t.Lead_Time).HasColumnName("Lead Time");
            this.Property(t => t.Barcode).HasColumnName("Barcode");
            this.Property(t => t.LastPurchaseDate).HasColumnName("LastPurchaseDate");
            this.Property(t => t.Item_Currency).HasColumnName("Item Currency");
            this.Property(t => t.IdCurrency).HasColumnName("IdCurrency");
            this.Property(t => t.LlRate).HasColumnName("LlRate");
            this.Property(t => t.DolRate).HasColumnName("DolRate");
            this.Property(t => t.LlRateNow).HasColumnName("LlRateNow");
            this.Property(t => t.DolRateNow).HasColumnName("DolRateNow");
            this.Property(t => t.RetailListPriceLL).HasColumnName("RetailListPriceLL");
            this.Property(t => t.RetailListPrice_).HasColumnName("RetailListPrice$");
            this.Property(t => t.WholesaleListPriceLL).HasColumnName("WholesaleListPriceLL");
            this.Property(t => t.WholesaleListPrice_).HasColumnName("WholesaleListPrice$");
            this.Property(t => t.symbol).HasColumnName("symbol");
        }
    }
}
